<template>
	<view>
	    <view class="logopic">
	        <view class="ytitle">经销商发货系统</view>  
	    </view>
	    <view class="formitem">
	        <view class="inpuitem">
	            <input type="text" placeholder-class="plac"
	             v-model="username"  placeholder="请输入登录账号" />
	            <image class="icon1" src="https://ayh.wissun.net/static/ayh/icon2.png" />
	        </view>
	        <view class="inpuitem">
	            <input type="password" placeholder-class="plac" v-model="password"  placeholder="密码" />
	            <image class="icon1" src="https://ayh.wissun.net/static/ayh/icon1.png" />
	        </view>
	        <view class="logbtn" @click="gologin">登录</view>
	         <!-- <view class="wangjipass">《系统操作说明》</view> -->
			 
	    </view>
		 <view class="goback">
		     <view class="lik" @click="goback">返回我的主页</view>
		 </view>
	</view>  
</template>

<script>
	
	export default {
		data() {
			return {
				logo:"static/images/logo.png",
				wxpic:"static/images/wx.png",
				username:"",
				password:"",
				remember:'0'
			}
		},
		onLoad() {},
		onShow() {
			let that = this;
			var remember=uni.getStorageSync("remember")
			if(remember == "1"){
				var u=uni.getStorageSync("username")
				if(u){
					this.username=u
				}
				var uu=uni.getStorageSync("password")
				if(uu){
					this.password=uu
				}
			}
			this.remember=remember;
		},
		methods: {
			onCheckboxChange(event) {
			  if(event.detail.value.length == 0){
				  this.remember="0"
			  }else{
				   this.remember="1"
			  }
			},
			goback(){
				uni.switchTab({
					url:"/pages/index/user"
				})
			},
			//登录方法
			gologin(){
				if(this.username == ""){
					uni.showToast({ title:"请输入登录账号",icon:"none"})
					return
				}
				if(this.password == ""){
					uni.showToast({ title:"请输入登录密码",icon:"none"})
					return
				}
				uni.showLoading({
					title:"登录中...",
					mask:true
				})
				var postdata={}
				postdata.username=this.username
				postdata.password=this.password
				this.request('/api/duoqudao/login', postdata,"post").then(data => {
					console.log('data',data)
					uni.hideLoading()
					uni.setStorageSync('fahuo_username',data.userinfo)
				    uni.setStorageSync('fahuo_jxs_token', data.token)
					uni.reLaunch({
						url:"/pages/main/duojifahuo/index"
					})
				})
			}
		}
	}
</script>

<style>
	page{
	  background-color: #009688;
	}
	.logopic{
		text-align: center;
		margin-top: 20%;
	}
	.logopic image{
		width: 294rpx;
		height: 90px;
	}
	.ytitle{
	  font-size: 26px;
	  color: #fff;
	  font-weight: bold;
	}
	.wangjipass{
	  color: #fff;
	  text-align:right;
	  margin-right: 50px;
	  font-size: 12px;
	  margin-top: 30px;
	}
	.inpuitem{
		display: flex;
		justify-content: space-between;
		width: 70%;
		margin: 0 auto;
		border-bottom: 2px solid #fff;
		margin-bottom: 30px;
	}
	.formitem{
		margin-top: 100px;
	}
	.icon1{
		width: 30px;
		height: 30px;
	}
	.inpuitem input{
		height: 35px;
		line-height: 35px;
		width: calc(100% - 35px);
		color: #fff;
		padding-bottom: 10px;
	}
	.plac{
		color:#B0CAFA;font-size:16px;font-weight: bold;
	}
	.logbtn{
		text-align: center;
		/* background-color:#0169FF ; */
		background-color:#fff;
		color: #000;
		height: 40px;
		line-height: 40px;
		width: 70%;
		margin: 0 auto;
		border-radius: 20px;
	}
	.goback{
		position: fixed;
		width: 100%;
		text-align: center;
		bottom: 20px;
	}
	.lik{
		text-align: center;
		color: #fff;
	}
</style>